<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getContextPath() + '/'}">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
    <!-- Reset Stylesheet -->
    <link rel="stylesheet" href="resources/css/reset.css" type="text/css"
          media="screen" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="resources/css/style.css" type="text/css"
          media="screen" />
    <link rel="stylesheet" href="resources/css/invalid.css" type="text/css"
          media="screen" />

    <!-- jQuery -->
    <script src="resources/scripts/jquery-1.8.3.min.js"></script>
    <!-- jQuery Configuration -->
    <script type="text/javascript"
            src="resources/scripts/simpla.jquery.configuration.js"></script>


    <script src="resources/widget/dialog/jquery-ui-1.9.2.custom.min.js"></script>
    <link rel="stylesheet" href="resources/widget/dialog/jquery-ui.min.css" type="text/css"
          media="screen" />

    <script>
        //打开弹出框
        function openDialog(rpid, rid, date, price, type){
            $("#rpid").val(rpid);
            $("#date").html(date);
            $("#price").val(price);
            $("#rid").val(rid);
            $("[name='type'][type='radio'][value='" + type + "']").attr("checked", true);

            $("#price_dialog").dialog({
                title: "调整价格",
                width: 500,
                height: 400,
                modal: true
            });
        }
    </script>

</head>
<body>
    <div id="price_dialog" style="display: none;">
        <div class="tab-content default-tab" id="tab2">
            <form action="/system/updatepirce" method="post">
                <input id="rpid" name="id" type="hidden"/>
                <input id="rid" name="rid" type="hidden"/>
                <fieldset>
                    <p>
                        <label>日期：</label> <span id="date"></span>
                    </p>
                    <p>
                        <label>价格：</label> <input
                            class="text-input small-input" type="text" id="price"
                            name="price" />
                    </p>
                    <p>
                        <label>类型：</label> <input name="type" type="radio" value="0"/>普通 <input name="type" type="radio" value="1"/>特价
                    </p>
                    <p>
                        <input class="mybutton" type="submit" value="提交" />
                    </p>
                </fieldset>
                <div class="clear"></div>
                <!-- End .clear -->
            </form>
        </div>
    </div>

    <div id="main-content">
        <div class="content-box">
            <!-- End .content-box-header -->
            <div class="content-box-content">
                <div class="tab-content default-tab" id="tab1">
                    <table>
                        <thead>
                        <tr>
                            <th><input class="check-all" type="checkbox" /></th>
                            <th>房型</th>
                            <th>日期</th>
                            <th>价格</th>
                            <th>预订数量</th>
                            <th>剩余数量</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        <tr th:each="roomprice : ${roomprices}">
                            <td><input type="checkbox" /></td>
                            <td th:text="${roomprice.rid}">房型</td>
                            <td th:text="${#dates.format(roomprice.date, 'yyyy-MM-dd')}">日期</td>
                            <td th:text="${#numbers.formatCurrency(roomprice.price) + '(' + (roomprice.type == 0 ? '普通' : '特价') + ')'}">价格</td>
                            <td th:text="${roomprice.number}">预订数量</td>
                            <td th:text="${roomprice.hasNumber}">剩余数量</td>
                            <td><button class="mybutton" type="button" th:onclick="openDialog([[${roomprice.id}]], [[${roomprice.rid}]], [[${#dates.format(roomprice.date, 'yyyy-MM-dd')}]], [[${roomprice.price}]], [[${roomprice.type}]]);">修改</button></td>
                        </tr>
                        </tbody>


                        <tfoot>
                        <tr>
                            <td colspan="6">
                                <!-- 分页的页签 -->
                                <div class="pagination">
                                    <a href="#" title="First Page">&laquo; First</a><a href="#"
                                                                                       title="Previous Page">&laquo; Previous</a> <a href="#"
                                                                                                                                     class="number" title="1">1</a> <a href="#" class="number"
                                                                                                                                                                       title="2">2</a> <a href="#" class="number current" title="3">3</a>
                                    <a href="#" class="number" title="4">4</a> <a href="#"
                                                                                  title="Next Page">Next &raquo;</a><a href="#"
                                                                                                                       title="Last Page">Last &raquo;</a>
                                </div> <!-- End .pagination -->
                                <div class="clear"></div>
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
            <!-- End .content-box-content -->
        </div>
    </div>

</body>
</html>